<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%
	String rootPath = request.getContextPath();
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>微们支付 测试页面</title>
</head>
<body>
   
	<input type="text" id="prepay_id" name="prepay_id" value="${prepay_id}"/>
	<input type="text" id="appId" name="appId" value="${appId}"/>
	<input type="text" id="timeStamp" name="timeStamp" value="${timeStamp}"/>
	<input type="text" id="nonceStr" name="nonceStr" value="${nonceStr}"/>

	<input type="text" id="signType" name="signType" value="${signType}"/>
	<input type="text" id="paySign" name="paySign" value="${paySign}"/>
	
	<div id="paypackage">${paypackage}</div>
	<input type="button" id="paytest" value="paytest" onclick="callpay();"/>
	
</body>
<script type='text/javascript'
	src='<%=rootPath%>/static/js/jquery-3.1.1.min.js' charset='utf-8'></script>
<script type="text/javascript">
function callpay(){
	
	   alert($("#appId").val());
	   alert($("#timeStamp").val());
	   alert($("#nonceStr").val());
	   alert($("#paypackage").text());
	   alert($("#paySign").val());
	  
	   
	   WeixinJSBridge.invoke('getBrandWCPayRequest',{
	    "appId" :"${appId}","timeStamp" : "${timeStamp}",
	    "nonceStr" : "${nonceStr}",
	    "package" : "${paypackage}",
	    "signType" : "MD5", "paySign" : "${paySign}"
	      },function(res){
	    WeixinJSBridge.log(res.err_msg);
//	     alert(res.err_code + res.err_desc + res.err_msg);
	             if(res.err_msg == "get_brand_wcpay_request:ok"){  
	                 alert("微信支付成功!");  
	                 window.location.href='orderList.html';
	             }else if(res.err_msg == "get_brand_wcpay_request:cancel"){  
	                 alert("用户取消支付!");  
	             }else{  
	                alert("支付失败!");  
	             }  
	   })
	  }
</script>

</html>